#pragma once
#include "loghelper.hxx"
#include "utility.hxx"

#define PROPERTY_GET(name, type, getter)\
	public:\
	void Set##name(type val)\
	{\
		m_##name = val;\
		}\
	private:\
	__declspec ( property ( put = Set##name, get = getter ) ) type name;\
	type m_##name;

#define PROPERTY_SET(name, type, setter)\
	public:\
	type& Get##name(void) const\
	{\
	return m_##name;\
	}\
	private:\
	__declspec ( property ( put = setter, get = Get##name ) ) type name;\
	type m_##name;

#define PROPERTY(name, type)\
	public:\
	type Get##name(void) const\
	{\
	return m_##name;\
	}\
	PROPERTY_GET(name, type, Get##name);

#define APPENDMSG(task, msg, type) \
	if(1){\
	stringstream ss;\
	if (type<10){\
		ss<<"["<<Utility::GetCTime()<<"]";\
	}\
	const Task* t = task;\
	if (t)\
	{\
		ss<<t->Signature()<<" ";\
	}\
	ss<<msg;\
	DisplayMsg(ss.str(), type);\
	if (_filelog && (type==2||type==3||type==0))\
	{\
		_filelog->AppendInfo(ss.str());\
	}\
	}else (void)(0)

#define APPENDMSGEX(msg, type) \
	if(type>=0){\
	stringstream ss;\
	if (type<10){\
		ss<<"["<<Utility::GetCTime()<<"]";\
	}\
	ss<<msg;\
	DisplayMsg(ss.str(), type);\
	if (_filelog && (type==2||type==3||type==0))\
	{\
		_filelog->AppendInfo(ss.str());\
	}\
	}else (void)(0)

#define STR_VALUE(name) #name
#define PROPERTY_TASKINFO(name)\
	public:\
	std::string Get##name(void) const\
	{ return clientInfos[STR_VALUE(name)];}\
	void Set##name(const std::string& val)\
	{ clientInfos[STR_VALUE(name)] = val;}\
	private:\
	__declspec(property(put = Set##name, get = Get##name)) std::string name;
